﻿using System;

namespace SharpGym.Model
{
	public partial class PressaoArterial
	{
        public bool Equals(PressaoArterial other)
        {
            return Diastolica.Equals(other.Diastolica) && Sistolica.Equals(other.Sistolica);
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            return obj is PressaoArterial && Equals((PressaoArterial)obj);
        }

        public override int GetHashCode()
        {
            unchecked
            {
                return (Diastolica.GetHashCode() * 397) ^ Sistolica.GetHashCode();
            }
        }

        public static bool operator ==(PressaoArterial s1, PressaoArterial s2)
        {
            const double EPSILON = 0.000001;

            return s2 != null && (s1 != null && (Math.Abs(s1.Sistolica - s2.Sistolica) < EPSILON &&
                                                 Math.Abs(s1.Diastolica - s2.Diastolica) < EPSILON));
        }

        public static bool operator !=(PressaoArterial s1, PressaoArterial s2)
        {
            return !(s1 == s2);
        }
	}
}